﻿using System.Collections.Generic;
using System.Diagnostics;
using OpenLS.Core;

namespace OpenLS.Spreadsheet
{
    class DeleteDimensionUndoUnit<T> : IUndoUnit where T : Dimension
    {
        public DeleteDimensionUndoUnit(DimensionCollection<T> c, T item)
        {
            _owner = c;
            _item = item;
        }

        readonly DimensionCollection<T> _owner;
        readonly T _item;

        #region IUndoUnit Members

        public void Do()
        {
            var items = new List<T> { _item };
            _owner.Worksheet.InsertExitingDimensions(_item.Index, items);
            return;
        }

        public bool Merge(IUndoUnit unit)
        {
            return false;
        }

        #endregion
    }
}